package cn.script.app;

import cn.script.app.bean.ScriptInfo;
import cn.script.fxj.FXBaseController;
import cn.script.fxj.bind.FxBind;
import javafx.fxml.FXML;
import javafx.scene.control.*;


/**
 * 脚本设置信息
 */
public class ScriptSetAction extends FXBaseController {

    @FXML
    TextField sNum;

    @FXML
    ToggleGroup dupRadio;

    @FXML
    ChoiceBox<String> tCity;

    @FXML
    ChoiceBox<String> professional;

    @FXML
    CheckBox isBoss;

    @FxBind({
            "num=sNum.text"
            , "boss=isBoss.selected"
//            , "termCity=tCity.text"
//            "dup=group."
    })
    ScriptInfo scriptInfo;

    @FXML
    public void onPro(){
        String selectedItem = this.professional.getSelectionModel().getSelectedItem();
        this.scriptInfo.setProfessional(selectedItem);
    }

    @FXML
    public void onRadio() {
        RadioButton selectedToggle = (RadioButton) this.dupRadio.getSelectedToggle();
        this.scriptInfo.setDup(selectedToggle.getText());
    }

    @FXML
    public void onChange() {
        String selectedItem = this.tCity.getSelectionModel().getSelectedItem();
        this.scriptInfo.setTermCity(selectedItem);
    }

    public ScriptInfo getScriptInfo() {
        return this.scriptInfo;
    }

}
